<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>字符串找不同</title>
</head>
<body>
  <script>
    var s = 'abcd'
    var t = 'abcde'
      for(let i in s) {
        // replace() 参数2替换参数1
        // 将 t 的字符串的 abcd 替换为空字符
        t = t.replace(s[i], '')
        // console.log(i, t)
      }
    console.log(t)
  </script>
</body>
</html>